﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using VAdvantage.Utility;
using System.Data;

namespace VAdvantage.Model
{
    public class MActivity : X_C_Activity
    {
        /// <summary>
        /// Standard Constructor
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="C_Activity_ID">id</param>
        /// <param name="trxName">transaction</param>
        public MActivity(Ctx ctx, int C_Activity_ID, String trxName)
            : base(ctx, C_Activity_ID, trxName)
        {
            //super(ctx, C_Activity_ID, trxName);
        }	//	MActivity

        /// <summary>
        ///	Load Constructor
        /// </summary>
        /// <param name="ctx">context</param>
        /// <param name="dr">DataRow</param>
        /// <param name="trxName">transaction</param>
        public MActivity(Ctx ctx, DataRow dr, String trxName)
            : base(ctx, dr, trxName)
        {
            //super(ctx, rs, trxName);
        }	//	MActivity


        /// <summary>
        ///	After Save.Insert - create tree
        /// </summary>
        /// <param name="newRecord">insert</param>
        /// <param name="success">save success</param>
        /// <returns>true if saved</returns>
        protected Boolean AfterSave(Boolean newRecord, Boolean success)
        {
            if (!success)
            {
                return success;
            }
            //	Value/Name change
            if (!newRecord && (Is_ValueChanged("Value") || Is_ValueChanged("Name")))
            {
                MAccount.UpdateValueDescription(GetCtx(), "C_Activity_ID=" + GetC_Activity_ID(), Get_TrxName());
            }
            return true;
        }	//	afterSave

    }
}
